<?php

/**
 * @author xxxxxx
 * @copyright 2008
 */

class moduleManager
{
	function __construct(){}
	
	public function __get($moduleName)
	{
		global $mm;
		
		if (!$this->{$moduleName})
		{
			$this->load($moduleName);
		}

		return $this->{$moduleName};
	}
	
	function register($module)
	{
		$this->{$module->name} = $module;
		$this->{$module->name}->parent = $this;
	}
	
	function load($module, $register=false)
	{
		global $mm;
		
		if (!$mm->{$module})
		{
			require_once('./module.configs/'.$module.'.php');
		}
		
		if ($register===true)
		{
			$this->register($module);
		}
	}
	
	
}

?>